Optimal. Leaf size=217 \[ \frac {1}{8} \left (16 a b c d+4 a^2 \left (2 c^2+d^2\right )+b^2 \left (4 c^2+3 d^2\right )\right ) x-\frac {\left (8 a^2 b c d+8 b^3 c d-a^3 d^2+4 a b^2 \left (3 c^2+2 d^2\right )\right ) \cos (e+f x)}{6 b f}-\frac {\left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \cos (e+f x) \sin (e+f x)}{24 f}-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{12 b f}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 217, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {2870, 2832,
2813} \begin {gather*} \frac {1}{8} x \left (4 a^2 \left (2 c^2+d^2\right )+16 a b c d+b^2 \left (4 c^2+3 d^2\right )\right )-\frac {\left (a^3 \left (-d^2\right )+8 a^2 b c d+4 a b^2 \left (3 c^2+2 d^2\right )+8 b^3 c d\right ) \cos (e+f x)}{6 b f}-\frac {\left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \sin (e+f x) \cos (e+f x)}{24 f}-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{12 b f}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2813
Rule 2832
Rule 2870
Rubi steps
\begin {align*} \int (a+b \sin (e+f x))^2 (c+d \sin (e+f x))^2 \, dx &=-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}+\frac {\int (a+b \sin (e+f x))^2 \left (b \left (4 c^2+3 d^2\right )+d (8 b c-a d) \sin (e+f x)\right ) \, dx}{4 b}\\ &=-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{12 b f}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}+\frac {\int (a+b \sin (e+f x)) \left (b \left (12 a c^2+16 b c d+7 a d^2\right )+\left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \sin (e+f x)\right ) \, dx}{12 b}\\ &=\frac {1}{8} \left (16 a b c d+4 a^2 \left (2 c^2+d^2\right )+b^2 \left (4 c^2+3 d^2\right )\right ) x-\frac {\left (8 a^2 b c d+8 b^3 c d-a^3 d^2+4 a b^2 \left (3 c^2+2 d^2\right )\right ) \cos (e+f x)}{6 b f}-\frac {\left (2 a d (8 b c-a d)+3 b^2 \left (4 c^2+3 d^2\right )\right ) \cos (e+f x) \sin (e+f x)}{24 f}-\frac {d (8 b c-a d) \cos (e+f x) (a+b \sin (e+f x))^2}{12 b f}-\frac {d^2 \cos (e+f x) (a+b \sin (e+f x))^3}{4 b f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.83, size = 160, normalized size = 0.74 \begin {gather*} \frac {-48 \left (4 a^2 c d+3 b^2 c d+a b \left (4 c^2+3 d^2\right )\right ) \cos (e+f x)+16 b d (b c+a d) \cos (3 (e+f x))+3 \left (4 \left (16 a b c d+4 a^2 \left (2 c^2+d^2\right )+b^2 \left (4 c^2+3 d^2\right )\right ) (e+f x)-8 \left (4 a b c d+a^2 d^2+b^2 \left (c^2+d^2\right )\right ) \sin (2 (e+f x))+b^2 d^2 \sin (4 (e+f x))\right )}{96 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.28, size = 216, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {a^{2} c^{2} \left (f x +e \right )-2 a^{2} d c \cos \left (f x +e \right )+a^{2} d^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-2 a b \,c^{2} \cos \left (f x +e \right )+4 a b c d \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 a b \,d^{2} \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+b^{2} c^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 b^{2} d c \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+d^{2} b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )}{f}\) | \(216\) |
default | \(\frac {a^{2} c^{2} \left (f x +e \right )-2 a^{2} d c \cos \left (f x +e \right )+a^{2} d^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-2 a b \,c^{2} \cos \left (f x +e \right )+4 a b c d \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 a b \,d^{2} \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+b^{2} c^{2} \left (-\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 b^{2} d c \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+d^{2} b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )}{f}\) | \(216\) |
risch | \(a^{2} c^{2} x +\frac {x \,a^{2} d^{2}}{2}+2 x a b c d +\frac {x \,b^{2} c^{2}}{2}+\frac {3 x \,d^{2} b^{2}}{8}-\frac {2 \cos \left (f x +e \right ) a^{2} d c}{f}-\frac {2 \cos \left (f x +e \right ) a b \,c^{2}}{f}-\frac {3 \cos \left (f x +e \right ) a b \,d^{2}}{2 f}-\frac {3 \cos \left (f x +e \right ) b^{2} d c}{2 f}+\frac {d^{2} b^{2} \sin \left (4 f x +4 e \right )}{32 f}+\frac {b \,d^{2} \cos \left (3 f x +3 e \right ) a}{6 f}+\frac {b^{2} d \cos \left (3 f x +3 e \right ) c}{6 f}-\frac {\sin \left (2 f x +2 e \right ) a^{2} d^{2}}{4 f}-\frac {\sin \left (2 f x +2 e \right ) a b c d}{f}-\frac {\sin \left (2 f x +2 e \right ) b^{2} c^{2}}{4 f}-\frac {\sin \left (2 f x +2 e \right ) d^{2} b^{2}}{4 f}\) | \(244\) |
norman | \(\frac {\left (a^{2} c^{2}+\frac {1}{2} a^{2} d^{2}+2 a b c d +\frac {1}{2} b^{2} c^{2}+\frac {3}{8} d^{2} b^{2}\right ) x +\left (a^{2} c^{2}+\frac {1}{2} a^{2} d^{2}+2 a b c d +\frac {1}{2} b^{2} c^{2}+\frac {3}{8} d^{2} b^{2}\right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (4 a^{2} c^{2}+2 a^{2} d^{2}+8 a b c d +2 b^{2} c^{2}+\frac {3}{2} d^{2} b^{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (4 a^{2} c^{2}+2 a^{2} d^{2}+8 a b c d +2 b^{2} c^{2}+\frac {3}{2} d^{2} b^{2}\right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (6 a^{2} c^{2}+3 a^{2} d^{2}+12 a b c d +3 b^{2} c^{2}+\frac {9}{4} d^{2} b^{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {12 a^{2} d c +12 a b \,c^{2}+8 a b \,d^{2}+8 b^{2} d c}{3 f}-\frac {4 \left (a^{2} d c +a b \,c^{2}\right ) \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {\left (4 a^{2} d^{2}+16 a b c d +4 b^{2} c^{2}+3 d^{2} b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 f}+\frac {\left (4 a^{2} d^{2}+16 a b c d +4 b^{2} c^{2}+3 d^{2} b^{2}\right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {\left (4 a^{2} d^{2}+16 a b c d +4 b^{2} c^{2}+11 d^{2} b^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}+\frac {\left (4 a^{2} d^{2}+16 a b c d +4 b^{2} c^{2}+11 d^{2} b^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {2 \left (6 a^{2} d c +6 a b \,c^{2}+4 a b \,d^{2}+4 b^{2} d c \right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {4 \left (9 a^{2} d c +9 a b \,c^{2}+8 a b \,d^{2}+8 b^{2} d c \right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{4}}\) | \(604\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 224, normalized size = 1.03 \begin {gather*} \frac {96 \, {\left (f x + e\right )} a^{2} c^{2} + 24 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} c^{2} + 96 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a b c d + 64 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b^{2} c d + 24 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} d^{2} + 64 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} a b d^{2} + 3 \, {\left (12 \, f x + 12 \, e + \sin \left (4 \, f x + 4 \, e\right ) - 8 \, \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} d^{2} - 192 \, a b c^{2} \cos \left (f x + e\right ) - 192 \, a^{2} c d \cos \left (f x + e\right )}{96 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.35, size = 168, normalized size = 0.77 \begin {gather*} \frac {16 \, {\left (b^{2} c d + a b d^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \, {\left (16 \, a b c d + 4 \, {\left (2 \, a^{2} + b^{2}\right )} c^{2} + {\left (4 \, a^{2} + 3 \, b^{2}\right )} d^{2}\right )} f x - 48 \, {\left (a b c^{2} + a b d^{2} + {\left (a^{2} + b^{2}\right )} c d\right )} \cos \left (f x + e\right ) + 3 \, {\left (2 \, b^{2} d^{2} \cos \left (f x + e\right )^{3} - {\left (4 \, b^{2} c^{2} + 16 \, a b c d + {\left (4 \, a^{2} + 5 \, b^{2}\right )} d^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{24 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 459 vs.
\(2 (202) = 404\).
time = 0.26, size = 459, normalized size = 2.12 \begin {gather*} \begin {cases} a^{2} c^{2} x - \frac {2 a^{2} c d \cos {\left (e + f x \right )}}{f} + \frac {a^{2} d^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} d^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {a^{2} d^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 a b c^{2} \cos {\left (e + f x \right )}}{f} + 2 a b c d x \sin ^{2}{\left (e + f x \right )} + 2 a b c d x \cos ^{2}{\left (e + f x \right )} - \frac {2 a b c d \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {2 a b d^{2} \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {4 a b d^{2} \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {b^{2} c^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b^{2} c^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b^{2} c^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 b^{2} c d \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {4 b^{2} c d \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {3 b^{2} d^{2} x \sin ^{4}{\left (e + f x \right )}}{8} + \frac {3 b^{2} d^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{4} + \frac {3 b^{2} d^{2} x \cos ^{4}{\left (e + f x \right )}}{8} - \frac {5 b^{2} d^{2} \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{8 f} - \frac {3 b^{2} d^{2} \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{8 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right )^{2} \left (c + d \sin {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.52, size = 176, normalized size = 0.81 \begin {gather*} \frac {b^{2} d^{2} \sin \left (4 \, f x + 4 \, e\right )}{32 \, f} + \frac {1}{8} \, {\left (8 \, a^{2} c^{2} + 4 \, b^{2} c^{2} + 16 \, a b c d + 4 \, a^{2} d^{2} + 3 \, b^{2} d^{2}\right )} x + \frac {{\left (b^{2} c d + a b d^{2}\right )} \cos \left (3 \, f x + 3 \, e\right )}{6 \, f} - \frac {{\left (4 \, a b c^{2} + 4 \, a^{2} c d + 3 \, b^{2} c d + 3 \, a b d^{2}\right )} \cos \left (f x + e\right )}{2 \, f} - \frac {{\left (b^{2} c^{2} + 4 \, a b c d + a^{2} d^{2} + b^{2} d^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.14, size = 221, normalized size = 1.02 \begin {gather*} -\frac {6\,a^2\,d^2\,\sin \left (2\,e+2\,f\,x\right )+6\,b^2\,c^2\,\sin \left (2\,e+2\,f\,x\right )+6\,b^2\,d^2\,\sin \left (2\,e+2\,f\,x\right )-\frac {3\,b^2\,d^2\,\sin \left (4\,e+4\,f\,x\right )}{4}+48\,a\,b\,c^2\,\cos \left (e+f\,x\right )+36\,a\,b\,d^2\,\cos \left (e+f\,x\right )+48\,a^2\,c\,d\,\cos \left (e+f\,x\right )+36\,b^2\,c\,d\,\cos \left (e+f\,x\right )-4\,a\,b\,d^2\,\cos \left (3\,e+3\,f\,x\right )-4\,b^2\,c\,d\,\cos \left (3\,e+3\,f\,x\right )-24\,a^2\,c^2\,f\,x-12\,a^2\,d^2\,f\,x-12\,b^2\,c^2\,f\,x-9\,b^2\,d^2\,f\,x+24\,a\,b\,c\,d\,\sin \left (2\,e+2\,f\,x\right )-48\,a\,b\,c\,d\,f\,x}{24\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________